<template>
	<view class="complain">
		<!-- 投诉类型 -->
		<view class="type">
			<text class="type-title">投诉类型</text>
			<view class="type-view">
				<view class="type-li" v-for="(item, index) in typeLi" :key="index" @tap="hander(index, $event)">
					<!-- <view class="type-item" :class="isactive == index ? 'addclass' : '' ">{{item.name}}</view> -->
					<view class="type-item" :class="{ bgcolor: spanIndex.indexOf(index) > -1 }">{{ item.name }}</view>
				</view>
			</view>
		</view>
		
		<!-- 线条 -->
		<view class="view-hr"></view>

		<!-- 投诉文本 -->
		<view class="uni-textarea"><textarea @blur="bindTextAreaBlur" auto-height placeholder="输入投诉信息" placeholder-style="color:#ccc" /></view>
		
		<!-- 距离 -->
		<view class="view-m"></view>
		
		<!-- 上传图片 -->
		<vastwu-saveimg :imgListprop="photo_list" :num='9' :isBase64='true' :isSave='true' :size='180' @chooseImage='imglist_msg'  @delImg='del_imglist_msg' class="my-upload"></vastwu-saveimg>


		<!-- 提交 -->
		<view class="my-btn">提交</view>
		
	</view>
</template>

<script>
	import vastwuSaveimg from '../../components/vastwu-saveimg/vastwu-saveimg.vue'
	
export default {
	components: {vastwuSaveimg},
	data() {
		return {
			typeLi: [
				{
					name: '服务态度'
				},
				{
					name: '菜品问题'
				},
				{
					name: '付款问题'
				}
			],

			// 选中
			isactive: 0,
			spanIndex: []
		};
	},
	onLoad() {},
	methods: {
		hander(index, e) {
			// console.log(index, e);
			// this.isactive = index
			let arrIndex = this.spanIndex.indexOf(index);
			console.log(arrIndex);

			if (arrIndex > -1) {
				this.spanIndex.splice(arrIndex, 1);
			} else {
				this.spanIndex.push(index);
			}
		},
		bindTextAreaBlur: function(e) {
			console.log(e.detail.value);
		}
	}
};
</script>

<style lang="scss" scoped>
	
	
	.view-hr{
		margin: 40rpx 0;
		border-top: 1rpx solid #efefef;
	}
	
	.view-m{
		margin-top: 200rpx;
	}
.complain {


	// 投诉类型
	.type {
		padding: 0 40rpx;
		box-sizing: border-box;
		.type-title {
			line-height: 2;
			font-size: 36rpx;
		}
		.type-view {
			display: flex;
			.type-li {
				margin-right: 20rpx;
				.type-item {
					width: 170rpx;
					height: 60rpx;
					border-radius: 30rpx;
					border: 1px solid #ccc;
					color: #666;
					display: flex;
					align-items: center;
					justify-content: center;
				}
			}
		}

		.bgcolor {
			background-color: #f0ad4e;
			color: #fff !important;
			border: 1px solid #f0ad4e !important;
		}
	}

	// 投诉文本
	.uni-textarea{
		padding: 0 40rpx;
		box-sizing: border-box;
	}
	
	// 上传图片
	.my-upload{
		margin-top: 150rpx;
		padding: 0 40rpx !important;
		box-sizing: border-box;
	}
	
	// 提交
	.my-btn{
		width: 100%;
		height: 96rpx;
		background-color: #F0AD4E;
		color: #fff;
		display: flex;
		align-items: center;
		justify-content: center;
		position: absolute;
		bottom: 0;
	}
}
</style>
